#ifndef MESHLOADER_H
#define MESHLOADER_H

#include <QThread>
#include <QVector>
#include <QVector3D>
#include "mesh.h"

class UrdfParser;

struct MeshLoadData {
    QString linkName;
    QVector<Vertex> vertices;
    QVector<GLuint> indices;
    bool needsInit;
};

class MeshLoader : public QThread
{
    Q_OBJECT
public:
    explicit MeshLoader(UrdfParser* parser, QObject *parent = nullptr);
    ~MeshLoader();

protected:
    void run() override;

signals:
    void meshLoaded(const MeshLoadData& data);
    void progressUpdated(int progress);
    void loadFinished(bool success);

private:
    UrdfParser* m_parser;
    bool m_isRunning;
};

#endif // MESHLOADER_H
